﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Biz.Process
{
    public class Convert
    {
        private static Dictionary<string, string> _codes = null;
        public static string GetOldFactorFromNewFactor(string code)
        {
            if (_codes == null)
            {
                Init();
            }
            string oldCode = null;
            if (_codes != null) _codes.TryGetValue(code, out oldCode);
            return oldCode;
        }

        private static void Init()
        {
            _codes = new Dictionary<string, string>
            {
                {"w00000", "B01"},
                {"w01001", "001"},
                {"w01002", "002"},
                {"w01012", "003"},
                {"w01017", "010"},
                {"w01018", "011"},
                {"w01020", "015"},
                {"w02003", "550"},
                {"w03001", "570"},
                {"w03002", "571"},
                {"w19002", "520"},
                {"w20012", "039"},
                {"w20023", "037"},
                {"w20038", "040"},
                {"w20061", "038"},
                {"w20089", "041"},
                {"w20092", "036"},
                {"w20111", "020"},
                {"w20113", "021"},
                {"w20115", "022"},
                {"w20116", "023"},
                {"w20117", "024"},
                {"w20119", "026"},
                {"w20120", "027"},
                {"w20121", "028"},
                {"w20122", "029"},
                {"w20123", "030"},
                {"w20124", "031"},
                {"w20125", "032"},
                {"w20126", "033"},
                {"w20127", "034"},
                {"w20128", "035"},
                {"w21001", "065"},
                {"w21003", "060"},
                {"w21004", "062"},
                {"w21006", "063"},
                {"w21007", "064"},
                {"w21011", "101"},
                {"w21016", "070"},
                {"w21017", "072"},
                {"w21019", "071"},
                {"w21022", "090"},
                {"w22001", "080"},
                {"w23002", "110"},
                {"w25043", "540"},
                {"w33001", "350"},
                {"w33007", "351"},
                {"w99001", "061"},
                {"a00000", "B02"},
                {"a01010", "37"},
            };
        }
    }
}
